<template>
    <rx-dialog @handOk="handleOk" :oktext="$ti18('rxForm.closeBtn','关闭')" :showcancel="false" btnalign="right" order="top">
        <a-tabs defaultActiveKey="jsonView">
            <a-tab-pane :tab="i18n('apiEdit.jsonView','JSON视图')" key="jsonView">
                <json-viewer
                    :value="json"
                    :expand-depth="5"
                    copyable
                    boxed
                    sort
                ></json-viewer>
            </a-tab-pane>
            <a-tab-pane :tab="i18n('apiEdit.jsonData','JSON数据')" key="jsonData">
                <a-textarea v-model="jsonData"></a-textarea>
            </a-tab-pane>
        </a-tabs>
    </rx-dialog>
</template>
<script>
    import FormBoDefApi from '@/api/form/bo/formBoDef'
    import {Util} from "@lowcode/jpaas-common-lib"
    export default {
        name: 'SysInterfaceJson',
        props:["json","layerid","destroy"],
        data(){
            return {
                jsonData:""
            }
        },
        created() {
            this.getJson();
        },
        methods: {
            i18n(name,text,key){
                return this.$ti18(name,text,"sysInterfaceProject",key);
            },
            handleOk(){
                Util.closeWindow(this,"ok");
            },
            getJson() {
                this.jsonData = JSON.stringify(this.json);
            }
        }
    }
</script>
